package com.leap.listener;

import com.leap.entity.AccountCategoryView;
import com.leap.service.AccountCategoryService;
import com.leap.service.AccountService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class MainQueueListener {

    @Autowired
    AccountCategoryService accountCategoryService;

    @RabbitListener(queues = "categoryView",messageConverter = "jacksonConverter")
    public void categoryViewIncrement(AccountCategoryView entity) {
        accountCategoryService.incrementViewCount(entity.getAccountId(),entity.getCategoryId(),entity.getViewCount());

    }
}
